﻿using System.Collections.Generic;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;
using InvestmentIntelligence.Extensions;

namespace InvestmentIntelligence.DbModel.CustomModels
{
    public static class DerivativeList
    {
        private static readonly HashSet<SecurityClass.Types> AllDerivatives = new HashSet<SecurityClass.Types>
                                                                       {
                                                                           // Options.
                                                                           SecurityClass.Types.DividendIndexOption,
                                                                           SecurityClass.Types.DividendIndexOptionOTC,
                                                                           SecurityClass.Types.EquityIndexOption,
                                                                           SecurityClass.Types.EquityIndexOptionOTC,
                                                                           SecurityClass.Types.EquityStockOption,
                                                                           SecurityClass.Types.EquityStockOptionOTC,
                                                                           SecurityClass.Types.ExoticEquityOption,
                                                                           SecurityClass.Types.OptionOnaCommodity,
                                                                           SecurityClass.Types.OptionOnIndexFuture,

                                                                           // Futures.
                                                                           SecurityClass.Types.CommodityFutureEnergy,
                                                                           SecurityClass.Types.CommodityFuturePreciousMetals,
                                                                           SecurityClass.Types.CommodityFutureSoft,
                                                                           SecurityClass.Types.DividendFuture,
                                                                           SecurityClass.Types.EquityIndexFuture,
                                                                           SecurityClass.Types.EquityStockFutureOTC
                                                                       };

        public static bool Contains(SecurityClass.Types securityClass)
        {
            return AllDerivatives.Contains(securityClass);
        }

        public static ICollection<byte> AllDerivativeCodes 
        {
            get
            {
                return AllDerivatives.Select(t => (byte) t).ToArray(AllDerivatives.Count);
            }
        }

        public static IEnumerable<SecurityClass.Types> AllDerivativeTypes
        {
            get
            {
                return AllDerivatives;
            }
        }
    }
}
